package com.wangshouyu.mp.pay.v3.transactions;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @description 订单金额
 * @date 2020/8/14 9:28
 */
public class TransactionsAmount implements Serializable {

    /**
     * 总金额
     * 单位为分
     */
    @SerializedName(value = "total")
    @JsonProperty(value = "total")
    @JSONField(name = "total")
    private Integer total;

    /**
     * 用户支付金额
     * 单位为分
     */
    @SerializedName(value = "payer_total")
    @JsonProperty(value = "payer_total")
    @JSONField(name = "payer_total")
    private Integer payerTotal;

    /**
     * 货币类型
     */
    @SerializedName(value = "currency")
    @JsonProperty(value = "currency")
    @JSONField(name = "currency")
    private String currency;

    /**
     * 用户支付币种
     */
    @SerializedName(value = "payer_currency")
    @JsonProperty(value = "payer_currency")
    @JSONField(name = "payer_currency")
    private String payerCurrency;

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getPayerTotal() {
        return payerTotal;
    }

    public void setPayerTotal(Integer payerTotal) {
        this.payerTotal = payerTotal;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getPayerCurrency() {
        return payerCurrency;
    }

    public void setPayerCurrency(String payerCurrency) {
        this.payerCurrency = payerCurrency;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TransactionsAmount that = (TransactionsAmount) o;
        return Objects.equals(total, that.total) &&
                Objects.equals(payerTotal, that.payerTotal) &&
                Objects.equals(currency, that.currency) &&
                Objects.equals(payerCurrency, that.payerCurrency);
    }

    @Override
    public int hashCode() {
        return Objects.hash(total, payerTotal, currency, payerCurrency);
    }

    @Override
    public String toString() {
        return "TransactionsAmount{" +
                "total=" + total +
                ", payerTotal=" + payerTotal +
                ", currency='" + currency + '\'' +
                ", payerCurrency='" + payerCurrency + '\'' +
                '}';
    }

    public TransactionsAmount(Integer total, Integer payerTotal, String currency, String payerCurrency) {
        this.total = total;
        this.payerTotal = payerTotal;
        this.currency = currency;
        this.payerCurrency = payerCurrency;
    }

    public TransactionsAmount(Integer total) {
        this.total = total;
    }

    public TransactionsAmount() {
    }
}
